<?php
namespace App\Middleware;

/**
 * @brief 登陆验证中间件
 */
class Auth {
    public function handle() {
        //请求参数
        $params = \Http_Server::$request;
        $token = $params['token'] ?? '';
        if (!$token) {
            \Response::error('Auth: Token missing', 11, true);
        }
        $guid = \Auth\Jwt::checkToken($token);
        if (!$guid) {
            \Response::error('Auth: Invalid token', 12, true);
        }

        return true;
    }
}
